/**
 *	HANDLER.C -- implementation of HANDLER.H
 *	Author: Fabio Garcia <fabio@blastpress.com>
 **/

#include <sys/socket.h>
#include <sys/types.h>

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#include "utilities.h"
#include "handler.h"

int HandleConnection(int socket) {
	char buffer[MAX_LINE];
	while(1) {
		ReadLine(socket, buffer, MAX_LINE-1);
		printf("ReadLine: %s", buffer);
		WriteLine(socket, buffer, strlen(buffer));
		if(strcmp(buffer, "exit\n") == 0) {
			break;
		}
	}
	return 0;
}
